#include <stdio.h>
#include <stdlib.h>

void bubble_sort(int a[], int n)
{
    int flag = 1;
    for (int i = 0; i < n && flag; i++)
    {
        flag = 0;
        for (int j = n - 1; j > i; j--)
        {
            if (a[j] < a[j - 1])
            {
                int t = a[j];
                a[j] = a[j - 1];
                a[j - 1] = t;
                flag = 1;
            }
        }
    }
}

int main()
{
    /*******************code*******************/
    int a[] = {4, 3, 10, 8, 14, 13, 7, 30, 26, 17};
    bubble_sort(a, 10);
    printf("bubble_sort\n");
    for (int i = 0; i < 10; i++)
        printf("%3d", a[i]);
    printf("\n");
    /******************************************/
    printf("\n\n****************************\n");
    printf("Press Enter key to continue\n");
    getchar();
    return 0;
    /******************************************/
}
